package com.one.common;

import android.app.Application;

import com.alibaba.android.arouter.launcher.ARouter;
import com.one.common.config.MyContact;
import com.one.common.utils.Toaster;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

import cn.jpush.android.api.JPushInterface;

/**
 * creator: zhulunjun
 * time:    2018/8/3
 * describe:
 */
public class CommonApp extends Application {

    private static Application sApp;

    public static Application getInstance() {
        return sApp;
    }

    public static void init(Application app) {
        sApp = app;
        Toaster.init();
        ARouter.openLog();     // 打印日志
        ARouter.openDebug();   // 开启调试模式(如果在InstantRun模式下运行，必须开启调试模式！线上版本需要关闭,否则有安全风险)
        ARouter.init(sApp);   // 尽可能早，推荐在Application中初始化

        JPushInterface.setDebugMode(true);
        JPushInterface.init(sApp);

        UMConfigure.init(sApp, MyContact.UM_APPID, "default", UMConfigure.DEVICE_TYPE_PHONE, "");
        PlatformConfig.setWeixin(MyContact.WX_KEY, MyContact.WX_SECRET);

    }


}
